package com.itcanteen.medical.patient.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 患者
 * @author 1804A-TeamOne
 * @date 2020-12-17 16:10
 */

@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "patient")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Patient extends BaseEntity implements Serializable {

    /**
     * 用户名
     */
    @Column(name = "username", nullable = false)
    private String username;

    /**
     * 邮箱
     */
    @Column(name = "email", nullable = false)
    private String email;

    /**
     * 密码
     */
    @Column(name = "password", nullable = false)
    private String password;


    /**
     * 手机号
     */
    @Column(name = "phone", nullable = false)
    private Long phone;

    /**
     * 昵称
     */
    @Column(name = "nick_name", nullable = false)
    private String nickName;

    /**
     * 头像url
     */
    @Column(name = "head_image", nullable = false)
    private String headImage;

    /**
     * 余额
     */
    @Column(name = "balance", nullable = false)
    private BigDecimal balance;

    /**
     * 积分
     */
    @Column(name = "integral", nullable = false)
    private Integer integral;

    /**
     * 账户状态
     */
    @Column(name = "status", nullable = false)
    private Integer status;

    /**
     * 性别 0女 1男
     */
    @Column(name = "sex", nullable = false)
    private Integer sex;

    /**
     * 出生日期
     */
    @Column(name = "birth_date", nullable = false)
    private Date birthDate;

    /**
     * 身份证号码
     */
    @Column(name = "id_number", nullable = false)
    private String idNumber;

    /**
     * @author 1804A-TeamOne
     * @date 2020-12-17 15:23
     * @param username 用户名
     * @param password 密码
     * 注册 构造方法
     */
    public Patient (String username, String password) {
        this.username = username;
        this.password = password;
        this.nickName = this.username;
        this.status = 1;
        this.setCreateTime(new Date());
        this.setUpdateTime(this.getCreateTime());
        this.integral = 0;
        this.balance = new BigDecimal(0);
    }
}
